{include file='common/head'}
  <body>
  <div class="x-nav">
      <span class="layui-breadcrumb">
         <a href=" {:url('index/index/welcome')}">首页</a>
         <a href=" {:url('index/reals/shiming')}">返回上一页</a>
        <a href="">
          <cite>套餐设置</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
      设置套餐 <button class="layui-btn layui-bg-orange" onclick="x_admin_show('设置套餐','tadd')">增加 <i class="iconfont">&#xe6ae;</i></button>
      <table class="layui-table">
        <thead>
          <tr>
            <th>ID</th>
            <th>时间</th>
            <th>价格</th>
            <th>说明</th>
            <th>操作</th>
        </thead>
        <tbody>
		{volist name="res" id="res"}
          <tr>
            <td>{$key+1}</td>
            <td>{$res.phase_time}月</td>
            <td>{$res.price}元</td>
            <td>{$res.state}</td>
            <td class="td-manage">
			  <a title="删除"  onclick="return member_tdel(this,'{$res.tid}')">
                <i class="layui-icon">&#xe640;</i>
            </td>
          </tr>
		  {/volist}
        </tbody>
      </table>
	  设置特权 <button class="layui-btn layui-bg-orange" onclick="x_admin_show('添加特权','cadd')">增加 <i class="iconfont">&#xe6ae;</i></button>
      <table class="layui-table">
        <thead>
          <tr>
            <th>ID</th>
            <th>特权</th>
            <th>说明</th>
            <th>操作</th>
        </thead>
        <tbody>
		{volist name="arr" id="arr"}
          <tr>
            <td>{$key+1}</td>
            <td>{$arr.privilege}</td>
            <td>{$arr.state}</td>
            <td class="td-manage">
              <a title="删除"  onclick="return member_del(this,'{$arr.id}')" <!--href="javascript;cdel?id={$arr.id}-->">
                <i class="layui-icon">&#xe640;</i>
              </a>
            </td>
          </tr>
		  {/volist}
        </tbody>
      </table>
    <script>
      layui.use('laydate', function(){
        var laydate = layui.laydate;

        
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });

       /*用户-停用*/
      function member_stop(obj,id){
          layer.confirm('确认要停用吗？',function(index){

              if($(obj).attr('title')=='启用'){

                //发异步把用户状态进行更改
                $(obj).attr('title','停用')
                $(obj).find('i').html('&#xe62f;');

                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                layer.msg('已停用!',{icon: 5,time:1000});

              }else{
                $(obj).attr('title','启用')
                $(obj).find('i').html('&#xe601;');

                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                layer.msg('已启用!',{icon: 5,time:1000});
              }
              
          });
      }

      /*特权-删除*/
      function member_del(obj,id){
          layer.confirm('确认要删除吗？',function(index){
              $.ajax({
			    url:'{:URL('reals/cdel')}',
				data:{'id':id},
				type:'post',
				dataType:'json',
				success:function(msg){
					if(msg.code==1){
						$(obj).parents("tr").remove();
						layer.msg(msg.msg,{icon:1,time:1000});
					}else{
					    layer.msg(msg.msg,{icon:1,time:1000});
					}
				}
			  });
          });
      }
	  /*套餐-删除*/
	  function member_tdel(obj,id){
          layer.confirm('确认要删除吗？',function(index){
              $.ajax({
			    url:'{:URL('reals/tdel')}',
				data:{'id':id},
				type:'post',
				dataType:'json',
				success:function(msg){
					if(msg.code==1){
						$(obj).parents("tr").remove();
						layer.msg(msg.msg,{icon:1,time:1000});
					}else{
					    layer.msg(msg.msg,{icon:1,time:1000});
					}
				}
			  });
          });
      }
    </script>
	<script type="text/javascript">
		function loadXMLDoc()
		{
		  var xmlhttp;
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
			document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
			}
		  }
		xmlhttp.open("POST","/ajax/demo_post2.asp",true);
		xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		xmlhttp.send("fname=Bill&lname=Gates");
		}
</script>
  </body>

</html>